home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 1999-10-20 | 86.5 KB | 3,029 lines
#!/bin/bash -login # # $Author: matt $ # $Date: 1999/05/04 23:06:32 $ # # $Log: isinst,v $ # Revision 1.1 1999/05/04 23:06:32 matt # Initial revision # # Revision 1.1 1999/04/13 17:06:52 matt # Initial revision # # Revision 1.1 1999/03/22 19:08:29 matt # Initial revision # # Revision 1.15 99/03/18 09:47:11 09:47:11 alex () # Fix tracker bugs 587, 588, 589, 592, and 594. # # Revision 1.14 99/03/16 10:41:32 10:41:32 alex () # Made following changes: # 1. updated/modified list of base files # 2. redirect tar error (generated when user is unknown) to /dev/null # 3. update cgi-bin links in admin package # 4. update default install dir to /opt/trend # # Revision 1.13 1999/02/18 16:34:47 alex # Modified name of plugin instruction file. # # Revision 1.12 1999/02/12 07:38:33 alex # Addressed several issues. # 1. Change the owndership of the Spamdb directory. # 2. Move the prompting of plugin vs. sendmail to during the installaer than before installation. # 3. Added error handling when pluginst fails to correctly modify users sendmail.cf file. # # Revision 1.11 99/02/10 16:20:04 16:20:04 alex () # Added create/remove of Spamdb directory for anti-spamming features. # # Revision 1.10 99/01/26 11:45:30 11:45:30 alex () # Remove iscan.cat from ISADMIN installation. # # Revision 1.9 99/01/21 17:26:40 17:26:40 alex () # Fix bug with SMTP plugin removal that was leaving a file behind. # # Revision 1.8 99/01/20 11:04:19 11:04:19 alex () # Fixed bug in Exit() the was not starting daemons properly. # # Revision 1.7 99/01/19 12:10:49 12:10:49 alex () # Fix unable to start VirusWalls at exit. # # Revision 1.6 99/01/19 08:30:51 08:30:51 alex () # Adjust script to compensate for file differences between HP and Sol. Fix some minor bugs. # # Revision 1.5 99/01/15 12:36:03 12:36:03 alex () # Resolve missing/different files between HP and Solaris installation. # # Revision 1.4 99/01/13 11:13:45 11:13:45 alex () # Enhanced with SMTP plugin. # # Revision 1.3 99/01/07 11:25:31 11:25:31 alex () # General code cleanup. # # Revision 1.2 99/01/06 11:52:53 11:52:53 alex () # General code cleanup. # # Revision 1.1 99/01/06 11:49:12 11:49:12 alex () # Initial revision # # #============================================================= typeset INSTALLTYPE="Tar" typeset DASH="--------" typeset BOLD=`tput bold` typeset UNBOLD=`tput rmso` typeset BELL=`tput bel` #================== installation packages ==================== typeset BASEPKG="isbase.tz" typeset FTPPKG="isftp.tz" typeset ADMINPKG="isadm.tz" typeset HTTPPKG="ishttp.tz" typeset SMTPPKG="issmtp.tz" typeset TVCSPKG="istvcs.tz" typeset CVPPKG="iscvp.tz" typeset INSTALLCVP="NO" typeset ISPORS="issmtp" #================== installed packages ==================== typeset ISBASE="None" typeset ISFTP="None" typeset ISADMIN="None" typeset ISHTTP="None" typeset ISSMTP="None" typeset ISTVCS="None" typeset ISCVP="None" typeset PKG="IScan ISHTTP ISADMIN ISSMTP ISTVCS ISCVP" #================== trial version flags ==================== typeset ISFTPTRIAL="0" typeset ISHTTPTRIAL="0" typeset ISSMTPTRIAL="0" typeset ISCVPTRIAL="0" #================== packages to install ==================== typeset INSTFTP="NO" typeset INSTHTTP="NO" typeset INSTADMIN="NO" typeset INSTSMTP="NO" typeset INSTBASE="NO" typeset INSTTVCS="NO" typeset INSTCVP="NO" #================== default installation paths ==================== typeset FTPPATH="/opt/trend/ISFTP" typeset BASEPATH="/opt/trend/ISBASE" typeset SMTPPATH="/opt/trend/ISSMTP" typeset HTTPPATH="/opt/trend/ISHTTP" typeset ADMINPATH="/opt/trend/ISADMIN" typeset TVCSPATH="/opt/trend/ISTVCS" typeset CVPPATH="/opt/trend/ISCVP" #================== installation files & dir ===================== typeset BASEFILES="lpt\$vpn.518 cleanscan intscan.ini prescan.cgi srvscan vscan intscan.ini.orig upgrade uplog iscanpsw gentrial isgetcfg libvsapi.so geteng macr\$gen.517 macro.lst" typeset ADMINFILES="" typeset ADMINDIRS="bin cgi-bin config icons images msg Java" typeset FTPFILES="ISCANFTP iscanftp isftpd isftpd.trial" typeset HTTPFILES="ISCANHTTPPROXY iscanhttpproxy ishttpd ishttpd.trial" typeset SMTPFILES="ISCANSMTP iscansmtp issmtpd issmtpd.trial" typeset SMTPPLUGINFILES="isfilter isfilter.trial" # UPGRADE determines whether existing .ini and .log files should # be restored after the base installation typeset UPGRADE="NO" typeset LICENSE="NOTOK" typeset OLDBASE="" typeset OLDHTTP="" typeset RESP # temporary installation path, set in ChkPath typeset ISPATH function print { echo -e $* } function debug { print -n "this is debug $1 message from matt." } function PressAnyKey { print print -n "Press Enter to continue ..... " ; read } #====================================================== # IsTrialSW determines whether a given package is a trial # version. Flags are set up to indicate trial or not. #====================================================== function IsTrialSW { case $1 in ISFTP ) if [ -s $FTPPATH/isftpd.trial ] ; then ISFTPTRIAL=1 else ISFTPTRIAL=0 fi ;; ISSMTP ) test -s $SMTPPATH/issmtpd.trial || test -s $SMTPPATH/isfilter.trial if [ "$?" = "0" ] ; then ISSMTPTRIAL=1 else ISSMTPTRIAL=0 fi ;; ISHTTP ) if [ -s $HTTPPATH/ishttpd.trial ] ; then ISHTTPTRIAL=1 else ISHTTPTRIAL=0 fi ;; esac } #====================================================== # CheckSW will check to see whether a given package is # already installed. If a package is already installed # then a flag is set to indicate that. In addition, the # install request flag is cleared. #====================================================== function CheckSW { case $1 in ISBASE ) if [ -s /etc/iscan/pkg/ISBASE ] ; then ISBASE="Installed" INSTBASE="NO" fi ;; ISFTP ) if [ -s /etc/iscan/pkg/ISFTP ] ; then ISFTP="Installed" INSTFTP="NO" fi ;; ISSMTP ) if [ -s /etc/iscan/pkg/ISSMTP ] ; then ISSMTP="Installed" INSTSMTP="NO" fi ;; ISHTTP ) if [ -s /etc/iscan/pkg/ISHTTP ] ; then ISHTTP="Installed" INSTHTTP="NO" fi ;; ISADMIN ) if [ -s /etc/iscan/pkg/ISADMIN ] ; then ISADMIN="Installed" INSTADMIN="NO" fi ;; ISTVCS ) if [ -s /etc/iscan/pkg/ISTVCS ] ; then ISTVCS="Installed" INSTTVCS="NO" fi ;; ISCVP ) if [ -s /etc/iscan/pkg/ISCVP ] ; then ISCVP="Installed" INSTCVP="NO" fi ;; esac } #================================================= # ScanTrialPackages checks to see which packages # installed are trial versions and sets up flags # to indicate so. #================================================= function ScanTrialPackages { IsTrialSW ISFTP IsTrialSW ISHTTP IsTrialSW ISSMTP } #================================================= # ScanInstalledPackages checks to see which of the # InterScan packages are already installed. #================================================= function ScanInstalledPackages { CheckSW ISBASE CheckSW ISFTP CheckSW ISADMIN CheckSW ISHTTP CheckSW ISSMTP CheckSW ISTVCS CheckSW ISCVP } #================================================ # Header displays a standard header common to all # menus in the installation script. #================================================ function Header { tput clear print print "\t\t\tTrend FileScan for Linux 1.0" print print "\t\t\t Setup Script" print print " ---------------------------------------------------------------------" print } #============================================================= # ChkPath prompts the user to enter a path. The path the user # enters is checked to make sure it is not a reserved path and # that it is an absolute path (not relative). #============================================================= function ChkPath { typeset firstchar print -n "\t\tNew Path is --- " ; read ISPATH firstchar=`echo $ISPATH | cut -c1` if [ "$firstchar" != "" ] ; then if [ "$ISPATH" = "/etc/iscan" ] ; then print ${BOLD} print -n "\t\t$ISPATH is reserved for Trend FileScan for Linux internal use only." print -n "\t\tPlease select a different path." print ${UNBOLD} PressAnyKey ISPATH=`echo $1` fi if [ "$firstchar" != "/" ] ; then print -n "Path must be an ${BOLD}ABSOLUTE PATH${UNBOLD}." PressAnyKey ISPATH=`echo $1` fi else ISPATH=`echo $1` fi } #======================================================================= # ChkResp checks a NO/YES/QUIT user response. It only compares the first # character to make the decision so this routine must only be used with # the 3 responses listed above to prevent false matchings. Alternately, # the caller provides a default response that should be used if an # invalid response is typed in by the user. #======================================================================= function ChkResp { typeset firstchar firstchar=`echo $1 | cut -c1` if [ "$firstchar" = "" ] ; then RESP=$2 fi case $1 in [yY]* ) RESP=YES ;; [nN]* ) RESP=NO ;; [qQ]* ) RESP=QUIT ;; * ) RESP=$2 ;; esac } #===================================================== # Called by SMTP installation only. Ask_For_Com_Domain # will modify /etc/intscan.ini with the correct domain # name for the company. #===================================================== function Ask_For_Com_Domain { print "Please input the local internet domain name of your company : " print -n "==> " read DOMAIN print ed /etc/iscan/intscan.ini << T_EOF > /dev/null 2>/dev/null /^company_domain s/company_domain=\(.*\)/company_domain=$DOMAIN/ . w q T_EOF print "\tIf you want to modify your domain name, you can edit" print "\t/etc/iscan/intscan.ini. Go into the [smtp] section and" print "\tchange company_domain to the correct domain." print } #================================================================= # Iscan_or_Plugins displays a menu of choices to allow the user to # select whether they want to install the ISCAN SMTP or Sendmail # plugin. #================================================================= function Iscan_or_Plugins { loop=true while [ $loop = true ] ; do loop=false Header print print "\t1.\tInterScan Viruswall SMTP." print "\t2.\tInterScan VirusWall Plugins for Sendmail." print print -n "\t \tSelect an option > " ; read RESP case $RESP in 1 ) ISPORS="issmtp" ;; 2 ) ISPORS="isplug" ;; * ) print "${BELL}\t\tAn invalid choice was entered. Please try again." ; loop=true ;; esac done } #===================================================================== # Modify allows the user to modify the installation defaults. When the # installation options are satisfactory, the user can then begin the # actual install. #===================================================================== function Modify { print print "\t\tPress Enter to accept the default shown above." print -n "\t\tInstall Trend FileScan for Linux for $1? > " read RESP # if the user enters a CR, then they want the default options displayed if [ "$RESP" = "" ] ; then return fi case $1 in "BASE" ) ChkResp $RESP $INSTBASE if [ "$RESP" = "YES" ] ; then ChkPath $BASEPATH INSTBASE=YES BASEPATH=`echo $ISPATH` else INSTBASE=NO fi ;; "FTP" ) ChkResp $RESP $INSTFTP if [ "$RESP" = "YES" ] ; then ChkPath $FTPPATH INSTFTP=YES FTPPATH=`echo $ISPATH` else INSTFTP=NO fi ;; "HTTP" ) ChkResp $RESP $INSTHTTP if [ "$RESP" = "YES" ] ; then ChkPath $HTTPPATH INSTHTTP=YES HTTPPATH=`echo $ISPATH` else INSTHTTP=NO fi ;; "TVCS" ) ChkResp $RESP $INSTTVCS if [ "$RESP" = "YES" ] ; then ChkPath $TVCSPATH INSTTVCS=YES TVCSPATH=`echo $ISPATH` else INSTTVCS=NO fi ;; "SMTP" ) ChkResp $RESP $INSTSMTP if [ "$RESP" = "YES" ] ; then ChkPath $SMTPPATH INSTSMTP=YES SMTPPATH=`echo $ISPATH` else INSTSMTP=NO fi ;; "ADMIN" ) ChkResp $RESP $INSTADMIN if [ "$RESP" = "YES" ] ; then ChkPath $ADMINPATH INSTADMIN=YES ADMINPATH=`echo $ISPATH` else INSTADMIN=NO fi ;; "CVP" ) ChkResp $RESP $INSTCVP if [ "$RESP" = "YES" ] ; then ChkPath $CVPPATH INSTCVP=YES CVPPATH=`echo $ISPATH` else INSTCVP=NO fi ;; esac } #========================================= # FailMsg is not used in this file at all. #========================================= function FailMsg { print "${BOLD}" print "\t\tTrend FileScan for Linux $1 has been installed but not properly" print "\t\tsetup in your system, please contact your support channel." print "${UNBOLD}" } #==================================================== # StartInstall does the actual package installations. #==================================================== function StartInstall { Header grep "release 6" /etc/issue if [ "$?" != "0" ] ; then print $BOLD print "\tTrend FileScan for Linux now only support running on Linux 6.0 or above" print $UNBOLD PressAnyKey return fi if [ "$ISBASE" = "None" -a "$INSTBASE" = "NO" ] ; then print $BOLD print "\tYou must install Trend FileScan for Linux Base system." print $UNBOLD PressAnyKey return fi print "Checking for installed sub-systems." test "$INSTBASE" = "YES" -a "$ISBASE" = "Installed" if [ "$?" = "0" ] ; then print "InterScan Trend FileScan for Linux Base is already installed." INSTBASE="NO" fi test "$INSTADMIN" = "YES" -a "$ISADMIN" = "Installed" if [ "$?" = "0" ] ; then print "InterScan Trend FileScan for Linux CGI ADMIN is already installed." INSTADMIN="NO" fi if [ "$ISFTP" = "Installed" ] ; then print "InterScan VirusWall for FTP is installed." fi if [ "$ISHTTP" = "Installed" ] ; then print "InterScan VirusWall for HTTP is installed." fi if [ "$ISSMTP" = "Installed" ] ; then print "InterScan VirusWall for SMTP is installed." fi if [ "$ISTVCS" = "Installed" ] ; then print "InterScan VirusWall for TVCS is installed." fi test "$INSTTVCS" = "YES" && test "$ISADMIN" = "None" && test "$INSTADMIN" = "NO" if [ "$?" = "0" ] ; then print "" print "To install InterScan VirusWall for TVCS, you must first" print " install InterScan VirusWall for CGI ADMIN." INSTTVCS="NO" fi # CVP installation should not come here if [ $INSTALLCVP = "NO" ] ; then # set file creation mode umask 222 #==================# # Install INSTBASE # #==================# if [ "$INSTBASE" = "YES" ] ; then # BASE for HP if [ "$INSTALLTYPE" = "Tar" ] ; then if [ -d /etc/iscan ] ; then print "${BOLD}\tPlease uninstall the existing version of Trend FileScan for Linux" print "\tbefore installing a new version.${UNBOLD}" else BaseInstallUsingTar fi fi fi #===================# # Install INSTADMIN # #===================# if [ "$INSTADMIN" = "YES" ] ; then # ADMIN for HP if [ "$INSTALLTYPE" = "Tar" ] ; then AdminInstallUsingTar else InstallADMOnly fi fi ScanTrialPackages # check software license only if ISFTP or ISHTTP or ISSMTP is being installed test "$INSTFTP" = "YES" || test "$INSTHTTP" = "YES" || test "$INSTSMTP" = "YES" if [ "$?" = "0" ] ; then CheckLicense fi #===============# # Install ISFTP # #===============# if [ "$INSTFTP" = "YES" ] ; then # FTP for HP if [ "$INSTALLTYPE" = "Tar" ] ; then FTPInstallUsingTar fi fi #==============# # Install HTTP # #==============# if [ "$INSTHTTP" = "YES" ] ; then # HTTP for HP if [ "$INSTALLTYPE" = "Tar" ] ; then HTTPInstallUsingTar fi fi #==============# # Install SMTP # #==============# if [ "$INSTSMTP" = "YES" ] ; then # SMTP for HP if [ "$INSTALLTYPE" = "Tar" ] ; then SMTPInstallUsingTar fi # Ask_For_Com_Domain fi #==============# # Install TVCS # #==============# if [ "$INSTTVCS" = "YES" ] ; then # TVCS for HP if [ "$INSTALLTYPE" = "Tar" ] ; then TVCSInstallUsingTar fi fi else # start install CVP StartInstallCVP fi RESP="" test "$ISFTPTRIAL" = "YES" || test "$ISHTTPTRIAL" = "YES" || \ test "$ISSMTPTRIAL" = "YES" || test "$ISCVPTRIAL" = "YES" if [ "$?" = "0" ] ; then TRIAL_DAYS=30 LIC=`/etc/iscan/gentrial $TRIAL_DAYS` echo echo " This trial version of InterScan will expire in 30 days, after which" echo " virus protection on your system will be disabled. To ensure continuous" echo " protection please purchase InterScan VirusWall. Check the following" echo " URL for more information: http://www.antivirus.com/buy/index.htm" echo PressAnyKey ADDRESS=root if [ "$UPGRADE" = "YES" ] ; then grep "license=" /etc/iscan/intscan.ini if [ "$?" != "0" ] ; then ed /etc/iscan/intscan.ini << T_EOF > /dev/null 2>/dev/null /HttpScan= i license=xxxxxx . w q T_EOF fi fi if [ "$LIC" != "" ] ; then sed -e 's/license=xxxxxx/license='$LIC'/' < /etc/iscan/intscan.ini > /tmp/iscandd \cp /tmp/iscandd /etc/iscan/intscan.ini fi CUR_PWD=`pwd` cd /tmp echo "echo \"The trial version of InterScan VirusWall you have installed will expire in: 28 DAYS. For infomation on how you upgrade to the enterprise edition of InterScan VirusWall, call TrendMicro at: 1-800-228-5651 or visit us at our web site: http://www.antivirus.com\" | mail -s'InterScan expire notification' ${ADDRESS}" | at now "+ 2day" 2>/tmp/tmpid echo "echo \"The trial version of InterScan VirusWall you have installed will expire in: 21 DAYS. For infomation on how you upgrade to the enterprise edition of InterScan VirusWall, call TrendMicro at: 1-800-228-5651 or visit us at our web site: http://www.antivirus.com\" | mail -s'InterScan expire notification' ${ADDRESS}" | at now "+ 9day" 2>>/tmp/tmpid echo "echo \"The trial version of InterScan VirusWall you have installed will expire in: 14 DAYS. For infomation on how you upgrade to the enterprise edition of InterScan VirusWall, call TrendMicro at: 1-800-228-5651 or visit us at our web site: http://www.antivirus.com\" | mail -s'InterScan expire notification' ${ADDRESS}" | at now "+ 16day" 2>>/tmp/tmpid echo "echo \"The trial version of InterScan VirusWall you have installed will expire in: 7 DAYS. For infomation on how you upgrade to the enterprise edition of InterScan VirusWall, call TrendMicro at: 1-800-228-5651 or visit us at our web site: http://www.antivirus.com\" | mail -s'InterScan expire notification' ${ADDRESS}" | at now "+ 23day" 2>>/tmp/tmpid echo "echo \"The trial version of InterScan VirusWall you have installed on your system has expired. For information on how you can upgrade to the enterprise edition of InterScan VirusWall, call TrendMicro at: 1-800-228-5651 or visit us at our web site: http://www.antivirus.com\" | mail -s'InterScan expire notification' ${ADDRESS}" | at now "+ 30day" 2>>/tmp/tmpid echo "echo \"# expire is yes\" >> /etc/iscan/intscan.ini" | at now "+ 30day" 2>>/tmp/tmpid cd $CUR_PWD ATID=`grep job /tmp/tmpid | cut -d' ' -f2` for ind in ${ATID} ; do echo "# notify_id is ${ind}" >> /etc/iscan/intscan.ini done rm -f /tmp/tmpid rm -f /tmp/iscandd cat /dev/null > /etc/iscan/gentrial TRIAL="NO" else PressAnyKey fi } #========================================================== # Install presents the user with a menu that allows them to # modify the install options and paths for the individual # ISCAN packages. #========================================================== function Install { StartInstall MainMenu # Check if Install CVP already, need to remove it first. # if [ $ISCVP = "Installed" ] ; then # print "Please remove CVP before proceeding with install." # return # fi # while ( true ); do # Header # DisplayInstallationOptions ALL # print # print "\tInstall Menu" # print # print "\t1.\tModify option for Trend FileScan for Linux for BASE." # print "\t2.\tModify option for Trend FileScan for Linux for ADMIN." # print "\t3.\tStart installation." # print "\t4.\tReturn to the previous menu." # print "\t5.\tExit." # print # print -n "\t\tSelect a number > " ; read RESP ; # case $RESP in # 1 ) DisplayInstallationOptions BASE # Modify BASE ;; # 2 ) DisplayInstallationOptions ADMIN # Modify ADMIN ;; # 3 ) StartInstall ;; # 4 ) MainMenu ;; # 5 ) Exit ;; # * ) print "${BELL}\t\tInvalid choice. Please try again." # PressAnyKey ;; # esac # done } #==================================================================== # StartRemove does the actual removal of the individual packages. The # package to remove is passed in as the first parameter. #==================================================================== function StartRemove { case $1 in #=============# # BASE System # #=============# BASE ) if [ "$ISBASE" = "None" ] ; then print $BOLD print "\t\tTrend FileScan for Linux BASE package is not installed." print $UNBOLD PressAnyKey return fi for i in $ISFTP $ISHTTP $ISADMIN $ISSMTP $ISCVP $ISTVCS; do if [ "$i" = "Installed" ] ; then print $BOLD print "\t\tPlease remove other sub-system(s) first" print "\t\tbefore removing $1 System." print $UNBOLD PressAnyKey return fi done Header print $BOLD print "\t\tRemoving Trend FileScan for Linux $1 package means no " print "\t\tVirus Scan functionality will exist on the system. " print -n "\t\tDo you want to remove this package? > " read RESP print $UNBOLD ChkResp $RESP "NO" if [ "$RESP" = "NO" ] ; then return fi # remove BASE for HP if [ "$INSTALLTYPE" = "Tar" ] ; then BaseRemoveUsingTar # remove BASE for Solaris elif [ "$INSTALLTYPE" = "AddPkg" ] ; then pkgrm -R `cat /etc/iscan/pkg/ISBASE` ISBASE if [ "$?" = "0" -a ! -r /etc/iscan ] ; then ISBASE="None" INSTBASE="YES" fi fi ;; #==============# # ADMIN System # #==============# ADMIN ) if [ "$ISADMIN" = "None" ] ; then print ${BOLD} print "\t\tTrend FileScan for Linux ADMIN package is not installed." print ${UNBOLD} PressAnyKey return fi Header # ADMIN cannot be removed if CVP/TVCS is installed test "$ISCVP" = "Installed" -o "$ISTVCS" = "Installed" if [ "$?" = "0" ] ; then print $BOLD print -n "\t\tPlease remove InterScan for " if [ "$ISCVP" = "Installed" ] ; then print -n "CVP" fi if [ "$ISTVCS" = "Installed" ] ; then print "TVCS" fi print "\t\tbefore removing InterScan for $1." print $UNBOLD PressAnyKey return fi print $BOLD print "\t\tRemoving the Trend FileScan for Linux $1 package, " print "\t\tyou will not be able to configure Trend FileScan " print "\t\tfor Linux from a web browser. " print -n "\t\tDo you want to remove this package? > " read RESP print $UNBOLD ChkResp $RESP "NO" if [ "$RESP" = "NO" ] ; then return fi # remove BASE for HP if [ "$INSTALLTYPE" = "Tar" ] ; then AdminRemoveUsingTar # remove BASE for Solaris elif [ "$INSTALLTYPE" = "AddPkg" ] ; then pkgrm -R `cat /etc/iscan/pkg/ISADMIN` ISADMIN test "$?" = "0" && ! -s /etc/rc.d/rc3.d/S99IScanHttpd if [ "$?" = "0" ] ; then ISADMIN="None" INSTADMIN="YES" fi fi ;; #============# # FTP System # #============# FTP ) if [ "$ISFTP" = "None" ] ; then print $BOLD print "\t\tInterScan FTP package is not installed." print $UNBOLD PressAnyKey return fi Header print $BOLD print "\t\tRemoving InterScan $1 VirusWall means your network users" print "\t\twill lose virus protection on their network file transfers." print -n "\t\tDo you want to remove this package? > " read RESP print $UNBOLD ChkResp $RESP "NO" if [ "$RESP" = "NO" ] ; then return fi # remove BASE for HP if [ "$INSTALLTYPE" = "Tar" ] ; then FTPRemoveUsingTar # remove BASE for Solaris elif [ "$INSTALLTYPE" = "AddPkg" ] ; then pkgrm -R `cat /etc/iscan/pkg/ISFTP` ISFTP if [ "$?" = "0" -a ! -s /etc/iscan/isftpd ] ; then ISFTP="None" INSTFTP="YES" fi ATID=`grep "# notify_id" /etc/iscan/intscan.ini | cut -d' ' -f4` for ind in ${ATID}; do atrm $ind done sed -e '/# notify_id/d' /etc/iscan/intscan.ini > /tmp/iscan$$ \mv /tmp/iscan$$ /etc/iscan/intscan.ini fi ;; #=============# # SMTP System # #=============# SMTP ) if [ "$ISSMTP" = "None" ] ; then print $BOLD print "\t\tInterScan SMTP package is not installed." print $UNBOLD PressAnyKey return fi Header print $BOLD print "\t\tRemoving InterScan $1 VirusWall means your network users" print "\t\twill lose virus protection on their e-mail transmissions." print -n "\t\tDo you want to remove this package? > " read RESP print $UNBOLD ChkResp $RESP "NO" if [ "$RESP" = "NO" ] ; then return fi # remove SMTP for HP if [ "$INSTALLTYPE" = "Tar" ] ; then SMTPRemoveUsingTar # remove SMTP for Solaris elif [ "$INSTALLTYPE" = "AddPkg" ] ; then pkgrm -R `cat /etc/iscan/pkg/ISSMTP` ISSMTP test "$?" = "0" && ! -s /etc/iscan/sendmail if [ "$?" = "0" ] ; then ISSMTP="None" INSTSMTP="YES" fi ATID=`grep "# notify_id" /etc/iscan/intscan.ini | cut -d' ' -f4` for ind in ${ATID}; do atrm $ind done sed -e '/# notify_id/d' /etc/iscan/intscan.ini > /tmp/iscan$$ \mv /tmp/iscan$$ /etc/iscan/intscan.ini fi ;; #=============# # HTTP System # #=============# HTTP ) if [ "$ISHTTP" = "None" ] ; then print $BOLD print "\t\tInterScan HTTP package is not installed." print $UNBOLD PressAnyKey return fi Header print $BOLD print "\t\tRemoving InterScan $1 VirusWall means your network users" print "\t\twill lose virus protection on their Internet and intranet" print -n "\t\tfile transfers. Do you want to remove this package? > " read RESP print $UNBOLD ChkResp $RESP "NO" if [ "$RESP" = "NO" ] ; then return fi # remove HTTP for HP if [ "$INSTALLTYPE" = "Tar" ] ; then HTTPRemoveUsingTar # remove HTTP for Solaris elif [ "$INSTALLTYPE" = "AddPkg" ] ; then pkgrm -R `cat /etc/iscan/pkg/ISHTTP` ISHTTP test "$?" = "0" && ! -s /etc/iscan/ishttpd if [ "$?" = "0" ] ; then ISHTTP="None" INSTHTTP="YES" fi ATID=`grep "# notify_id" /etc/iscan/intscan.ini | cut -d' ' -f4` for ind in ${ATID}; do atrm $ind done sed -e '/# notify_id/d' /etc/iscan/intscan.ini > /tmp/iscan$$ \mv /tmp/iscan$$ /etc/iscan/intscan.ini fi ;; #=============# # TVCS System # #=============# TVCS ) if [ "$ISTVCS" = "None" ] ; then print $BOLD print "\t\tInterScan TVCS package is not installed." print $UNBOLD PressAnyKey return fi Header print $BOLD print "\t\tPlease have your TVCS administrator remove this InterScan" print "\t\tregistration from TVCS console." print $UNBOLD # remove TVCS for HP if [ "$INSTALLTYPE" = "Tar" ] ; then TVCSRemoveUsingTar # remove TVCS for Solaris elif [ "$INSTALLTYPE" = "AddPkg" ] ; then pkgrm -R `cat /etc/iscan/pkg/ISTVCS` ISTVCS if [ "$?" = "0" ] ; then ISTVCS="None" INSTTVCS="YES" fi ed /etc/iscan/intscan.ini <<EOF >/dev/null 2>/dev/null 2>/dev/null /\[TVCS .,+14d . w q EOF fi ;; #=============# # CVP System # #=============# CVP ) # CVP is not supported in HP if [ "$INSTALLTYPE" = "Tar" ] ; then return fi if [ "$ISCVP" = "Installed" ] ; then Header pkgrm -R `cat /etc/iscan/pkg/ISCVP` ISCVP rm -f /etc/iscan/pkg/ISCVPON if [ "$?" = "0" && ! -s /etc/iscan/iscvp ] ; then ISCVP="None" INSTCVP="YES" ISCVPTRIAL="0" fi else print ${BOLD} print "\t\tYou haven't install InterScan CVP yet " print ${UNBOLD} return fi ATID=`grep "# notify_id" /etc/iscan/intscan.ini | cut -d' ' -f4` for ind in ${ATID}; do atrm $ind done sed -e '/# notify_id/d' /etc/iscan/intscan.ini > /tmp/iscan$$ \mv /tmp/iscan$$ /etc/iscan/intscan.ini ;; esac # if there are no more trial software installed then remove all at jobs ScanTrialPackages remove_at=0 test -s /etc/iscan/intscan.ini && test "$ISFTPTRIAL" != 1 && \ test "$ISHTTPTRIAL" != "1" -a "$ISSMTPTRIAL" != "1" if [ "$?" = "0" ] ; then if [ "$INSTALLTYPE" = "Tar" ] ; then remove_at=1 elif [ "$ISCVPTRIAL" != 1 ] ; then remove_at=1 fi fi if [ "$remove_at" = 1 ] ; then ATID=`grep "# notify_id" /etc/iscan/intscan.ini | cut -d' ' -f4` for ind in $ATID ; do atrm $ind done sed -e '/# notify_id/d' /etc/iscan/intscan.ini > /tmp/iscan$$ \mv /tmp/iscan$$ /etc/iscan/intscan.ini fi PressAnyKey } #======================================================== # Remove presents a menu to the user which allows them to # select a particular package for removal or to remove # all packages. #======================================================== function Remove { RemoveAll MainMenu # while [ true ] ; do # Header # print "\tRemove Menu" # print # print "\t1.\tRemove Trend FileScan for Linux Base System." # print "\t2.\tRemove Trend FileScan for Linux Admin System." # print "\t3.\tRemove All Trend FileScan for Linux System." # print "\t4.\tReturn to the previous menu." # print "\t5.\tExit." # print # print -n "\t\tSelect a number > " # read RESP # case $RESP in # 1 ) StartRemove "BASE" ;; # 2 ) StartRemove "ADMIN" ;; # 3 ) RemoveAll ;; # 4 ) MainMenu ;; # 5 ) Exit ;; # * ) print "${BELL}\t\tInvalid choice. Please try again." # PressAnyKey ;; # esac # done } #============ # CVP routine #============ function RemoveCVP { typeset RESPCVP while (true) ; do Header print print "\t1.\tRemove InterScan VirusWall Base System." print "\t2.\tRemove InterScan VirusWall Admin System." print "\t3.\tRemove InterScan VirusWall CVP System." print "\t4.\tRemove InterScan VirusWall TVCS System." print "\t5.\tRemove All InterScan VirusWall System." print "\t6.\tBack to Main Menu." print print -n " Select a number > ";read RESPCVP case $RESPCVP in 1 )StartRemove "BASE" ;; 2 )StartRemove "ADMIN" ;; 3 )StartRemove "CVP" ;; 4 )StartRemove "TVCS" ;; 5 )RemoveAll ;; 6 )MainMenuCVP ;; * ) print "${BELL}\t\tAn invalid choice was entered. Please try again." esac done } #============================================================================ # Exit terminates the installation. Additionally, it prompts the user whether # they want to start VirusWall or not. #============================================================================ function Exit { # remove temporary support directory rm -rf /tmp/iscan_support if [ ! -s /etc/iscan ] ; then exit 0 fi print print "\tYou can configure Trend FileScan for Linux via" print "\ttype in the URL: http://your-host-name:1812/interscan " print "\ton the web browser." print PressAnyKey exit 0 } #======================================================= # ConfigIScanUsingBrowser launches a browser connecting with port # 1812. # NOTE: the function terminates installation. #======================================================= function ConfigIScanUsingBrowser { typeset NETSCAPE typeset BROWSER typeset BROWSERPATH typeset firstchar typeset HOSTNAME if [ "$ISADMIN" != "Installed" ] ; then print ${BOLD} print "\t\tPlease install the Trend FileScan for Linux ADMIN package first." print ${UNBOLD} PressAnyKey return fi Header print -n "\tPlease identify the browser you use [netscape]: " read BROWSER # NETSCAPE will be set to the browser entered by the user or # netscape if the user did not enter anything NETSCAPE=${BROWSER:-"netscape"} BROWSER=`/usr/bin/which $NETSCAPE 2> /dev/null` # browser was not found, prompt the user for the path if [ ! -s $BROWSER ] ; then print -n "\tEnter the full path to your browser: " read BROWSERPATH if [ ! -s $BROWSERPATH/$NETSCAPE ] ; then print $BOLD print "\t\t$BROWSERPATH/$NETSCAPE does not exist." print $UNBOLD PressAnyKey # before return, is there an alternate method to config # IScan that should be presented to the user? return fi HOSTNAME=`hostname` NETSCAPE=`echo $BROWSERPATH/$NETSCAPE` else HOSTNAME=`hostname` NETSCAPE=`echo $NETSCAPE` fi # launch the browser exec $NETSCAPE $HOSTNAME:1812/interscan & # terminate installation script exit 0 } #============= # CVP routine. #============= function MainStatusCVP { print "\t\tCurrent System Configuration : " print print "\t\tInstalled :\tAlready installed on the system" print "\t\tNone:\t\tNot found on the system" print print "\t\tInterScan VirusWall Base System\t ${DASH} [ ${BOLD}${ISBASE}${UNBOLD}\t]" if [ "$ISBASE" = "Installed" ] ; then BASEPATH=`cat /etc/iscan/pkg/ISBASE` print "\t\tInstallation Path\t${BOLD}${BASEPATH}${UNBOLD}" fi print print "\t\tInterScan VirusWall CGI Admin\t ${DASH} [ ${BOLD}${ISADMIN}${UNBOLD}\t]" if [ "$ISADMIN" = "Installed" ] ; then ADMINPATH=`cat /etc/iscan/pkg/ISADMIN` print "\t\tInstallation Path\t${BOLD}${ADMINPATH}${UNBOLD}" fi print if [ "$ISCVP" = "Installed" ] ; then CVPPATH=`cat /etc/iscan/pkg/ISCVP` if [ -s $CVPPATH/IScan.CVP/iscvp.trial ] ; then ISCVPTRIAL=1 print "\t\tInterScan VirusWall Trial for CVP ${DASH} [ ${BOLD}${ISCVP}${UNBOLD}]" else print "\t\tInterScan VirusWall for CVP\t ${DASH} [ ${BOLD}${ISCVP}${UNBOLD}]" fi print "\t\tInstallation Path\t${BOLD}${CVPPATH}${UNBOLD}" else print "\t\tInterScan VirusWall for CVP\t ${DASH} [ ${BOLD}${ISCVP}${UNBOLD}\t]" fi print if [ "$ISTVCS" = "Installed" ] ; then TVCSPATH=`cat /etc/iscan/pkg/ISTVCS` print "\t\tInterScan VirusWall for TVCS\t ${DASH} [ ${BOLD}${ISTVCS}${UNBOLD}\t]" print "\t\tInstallation Path\t${BOLD}${TVCSPATH}${UNBOLD}" else print "\t\tInterScan VirusWall for TVCS\t ${DASH} [ ${BOLD}${ISTVCS}${UNBOLD}\t]" fi print } function DisplayInstallationOptions { print "\t=============== INSTALLATION OPTIONS ==================" print case $1 in #=============# # BASE System # #=============# "BASE" ) print "\tInstall Trend FileScan for Linux Base System\t ${DASH} [ ${BOLD}${INSTBASE}${UNBOLD} ]" print "\tBase install path\t${BOLD}${BASEPATH}${UNBOLD}" ;; #==============# # ADMIN System # #==============# "ADMIN" ) print "\tInstall Trend FileScan for Linux Admn System\t ${DASH} [ ${BOLD}${INSTADMIN}${UNBOLD} ]" print "\tAdmin install path\t${BOLD}${ADMINPATH}${UNBOLD}" ;; #============# # ALL System # #============# "ALL" ) print "\tInstall Trend FileScan for Linux Base System\t ${DASH} [ ${BOLD}${INSTBASE}${UNBOLD} ]" print "\t Base install path\t${BOLD}${BASEPATH}${UNBOLD}" print "\tInstall Trend FileScan for Linux Admn System\t ${DASH} [ ${BOLD}${INSTADMIN}${UNBOLD} ]" print "\t Admin install path\t${BOLD}${ADMINPATH}${UNBOLD}" esac print "\t=========================================================" } #============================================================= # DisplayCurrentConfig displays the status of InterScan packages # that are currently installed. For the installed packages, it # will also display the installation path. #============================================================= function DisplayCurrentConfig { # should not need to scan installed packages again # however, do it just in case some of the globals # are incorrect ScanInstalledPackages ScanTrialPackages print "\t=========================================================" #=============# # BASE System # #=============# print "\tTrend FileScan for Linux Base System\t\t[ ${BOLD}${ISBASE}${UNBOLD}\t]" if [ "$ISBASE" = "Installed" ] ; then BASEPATH=`cat /etc/iscan/pkg/ISBASE` print "\t Installation Path\t${BOLD}${BASEPATH}${UNBOLD}" fi #==============# # ADMIN System # #==============# print "\tTrend FileScan for Linux CGI Admin\t\t[ ${BOLD}${ISADMIN}${UNBOLD}\t]" if [ "$ISADMIN" = "Installed" ] ; then ADMINPATH=`cat /etc/iscan/pkg/ISADMIN` print "\t Installation Path\t${BOLD}${ADMINPATH}${UNBOLD}" fi print "\t=========================================================" } #==================================================================== # CheckForInstalledCVP checks to see if CVP is installed. If it is installed, # CheckForInstalledCVP gives the user the opportunity to remove CVP. # NOTE: CVP must be removed before VirusWall can be installed. #==================================================================== function CheckForInstalledCVP { # Check if allready installed CVP and remove all of then clear CheckSW "ISCVP" Header if [ "$ISCVP" = "Installed" ] ; then print $BOLD if [ "$ISCVPTRIAL" = "1" ] ; then print "\t\tYou are currently running CVP Trial Version." else print "\t\tYou are currently running InterScan for CVP." fi print "\t\tPlease remove it before installing this version." print $UNBOLD print -n "\tDo you want to remove it now? > " ; read RESP ChkResp $RESP "NO" if [ "$RESP" = "YES" ] ; then StartRemove "CVP" else Main fi fi } #================================================ # MainMenu presents the user with the main menu. # NOTE: for non-CVS only. #================================================ function MainMenu { typeset done=false # CVP must be removed prior to VirusWall # installation CheckForInstalledCVP while [ $done = false ] ; do done=true # DisplayCurrentConfig print print "\tMain Menu" print print "\t1.\tInstall Trend FileScan for Linux sub-system." print "\t2.\tRemove Trend FileScan for Linux sub-system." print "\t3.\tConfigure Trend FileScan for Linux via web browser." print "\t\tThis option will terminate the installation." if [ "$INSTALLTYPE" = "Tar" ] ; then print "\t4.\tExit." elif [ "$INSTALLTYPE" = "AddPkg" ] ; then print "\t4.\tReturn to the previous menu." print "\t5.\tExit." fi print print -n "\t\tSelect a number > " read RESP if [ "$INSTALLTYPE" = "Tar" ] ; then case $RESP in 1 ) Install done=false ;; 2 ) Remove ;; 3 ) ConfigIScanUsingBrowser done=false ;; 4 ) Exit ;; * ) print "${BELL}\t\tInvalid choice. Please try again." PressAnyKey done=false ;; esac elif [ "$INSTALLTYPE" = "AddPkg" ] ; then case $RESP in 1 ) Install done=false ;; 2 ) Remove ;; 3 ) ConfigIScanUsingBrowser done=false ;; 4 ) Main ;; 5 ) Exit ;; * ) print "${BELL}\t\tInvalid choice. Please try again." PressAnyKey done=false ;; esac fi done } #============================================================= # ChkPkg checks to see if the packages needed for installation # are found in the current directory. Knowing which tgz files # are available, it sets some default options of what to # install and what not to install. #============================================================= function ChkPkg { if [ -a ./$BASEPKG ] ; then INSTBASE="YES" fi if [ -a ./$ADMINPKG ] ; then INSTADMIN="YES" fi if [ -a ./$FTPPKG ] ; then INSTFTP="YES" fi if [ -a ./$SMTPPKG ] ; then INSTSMTP="YES" fi if [ -a ./$HTTPPKG ] ; then INSTHTTP="YES" fi if [ -a ./$TVCSPKG ] ; then #Force INSTTVCS=NO INSTTVCS="NO" fi if [ -a ./$CVPPKG ] ; then INSTCVP="YES" fi } #========== # Not used. #========== function PVCCINFO { clear print ; print ; print "Trend VCS Information:\n" ; print "\t1. InterScan host :[$host]"; print ; print "\t2. IP address of the InterScan machine:[$ipaddr]"; print ; print "\t3. Site name: [$LO]." ; print ; print "\t4. IP address of the Trend VCS server: [$VCC]." ; print ; } #========== # Not used. #========== function VCCINFOCHANGE { PVCCINFO print -n " Specify the item number to modify or press Enter to accept:> ";read infnum case $infnum in 1 ) print -n "\tInterScan host:> " ; read host;; 2 ) print -n "\tIP address of the InterScan machine:> "; read ipaddr ;; 3 ) print -n "\t Site name:> " ; read LO ;; 4 )print -n "\tIP address of the Trend VCS server:> "; read VCC ;; * ) print ;; esac PressAnyKey return } #========== # Not used. #========== function VCCINFO { print ; print host=`hostname`; ipaddr=`/etc/iscan/ip $host`; print -n "\tEnter the Trend VCS Site name for this server:> " ; read LO print -n "\tSpecify the IP address of the Trend VCS server:> " ; read VCC print -n "\t Trend VCS Information:\n" ; PVCCINFO print -n "\tCorrect?> " ; read RESP ChkResp $RESP "" } #========== # Not used. #========== function DoRegister { rg=`/opt/ISADMIN/IScan.adm/cgi-bin/Register /etc/iscan/solar.tmp` ; if [ $? -eq 1 ] ; then cat /etc/iscan/solar.tmp >>/etc/iscan/intscan.ini; rm /etc/iscan/solar.tmp echo "Registration successful." /etc/rc.d/init.d/iscantvcsagt start > /dev/null else sed -e 's/VccServer=*.*.*.*/VccServer=0/' < /etc/iscan/intscan.ini > /tmp/solar ; \cp /tmp/solar /etc/iscan/intscan.ini ; echo "Unable to register with the Trend VCS server." echo "Please check the IP address specified (and network connection) then try again." fi PressAnyKey return } #========== # Not used. #========== function VCCRegister { clear if [ -s /etc/iscan/ip ] ; then VCCINFO while (true) ; do if [ "$RESP" = "YES" ] ; then break; else clear VCCINFOCHANGE PVCCINFO print -n "\tCorrect? (Enter y/Y to accept, n/N to reject)> " ; read RESP ChkResp $RESP "" fi done LO=$(print $LO | tr ' ' '_') grep "TVCS" /etc/iscan/intscan.ini > /dev/null 2>&1; if [ $? -ne 0 ] ; then sed -e 's/VccServer=0[ ]*/VccServer='$VCC'/;s/Location=0[ ]*/Location='$LO'/;s/Server=0[ ]*/Server='$host'/;s/ServerIP=0[ ]*/ServerIP='$ipaddr'/' < /etc/iscan/solar.ini > /etc/iscan/solar.tmp; DoRegister else rc=`grep "VccServer=0" /etc/iscan/intscan.ini`; if [ $? -ne 0 ] ;then print "Registration already done!" exit 1 ; else sed -e 's/VccServer=0[ ]*/VccServer='$VCC'/' < /etc/iscan/intscan.ini > /tmp/solar ; \cp /tmp/solar /etc/iscan/intscan.ini; DoRegister fi fi else print ${BOLD} print -n "\t\tEnter a 1 to install Trend VCS." print ${UNBOLD} PressAnyKey return fi return } #============= # CVP routine. #============= function InstallCVPOnly { # start install cvp pkg and check the licence if [ "$INSTCVP" = "YES" ] ; then # check cvp pkg if [ ! -s ./$CVPPKG ] ; then print "\t\tCan not find InterScan CVP ($CVPPKG) in current directory." | fmt -70 PressAnyKey return fi # check license program exist or not # if [ ! -s /etc/iscan/license ] ; then # print -n " Can not find your license check program" # PressAnyKey # return # fi Header # print -n "\tEnter your serial number for InterScan VirusWall CVP : " # print -n ${BOLD} # /etc/iscan/license CVP # change pkg into trail version if serial number not match if [ "$LICENSE" != "OK" ] ; then print -n "\tDo you want to install InterScan VirusWall Trial version for CVP? > " ; read RESP ChkResp $RESP "NO" if [ $RESP = "YES" ] ; then TRIAL="YES" CVPPKG="iscvp.evl" else # print -n ${UNBOLD} return fi fi # print -n ${UNBOLD} # begin to install CVP (cd /tmp ; mkdir pkgcvp ) /bin/zcat < ./$CVPPKG | (cd /tmp/pkgcvp ; tar xf - ) pkgadd -d /tmp/pkgcvp -R "$CVPPATH" ISCVP if [ $? -ne 0 ] ; then echo $ERROR_LINE >> /usr/tmp/iscan_install_log rm -rf $CVPPATH else ISCVP="Installed" fi PressAnyKey rm -rf /tmp/pkgcvp INSTCVP="NO" fi } #================================================== # InstallTVCSOnly handles the installation of TVCS. # NOTE: it looks like TVCS is only installed when # SMTP VirusWall is installed. #================================================== function InstallTVCSOnly { if [ "$LICENSE" != "OK" ] ; then return fi if [ "$INSTTVCS" = "YES" && "$ISTVCS" = "Installed" ] ; then print "\t\t${BOLD}InterScan TVCS has been installed in your system${UNBOLD}" PressAnyKey INSTTVCS="NO" fi if [ "$INSTTVCS" = "YES" ] ; then if [ ! -s ./$TVCSPKG ] ; then print "\t\tCan not find InterScan TVCS ($TVCSPKG ) in current directory." | fmt -70 PressAnyKey return fi ( cd /tmp ; mkdir pkgtvcs ) /bin/zcat < ./$TVCSPKG | ( cd /tmp/pkgtvcs ; tar xf - ) pkgadd -d /tmp/pkgtvcs -R "$TVCSPATH" ISTVCS # append solar.ini to intscan.ini cat /etc/iscan/solar.ini >> /etc/iscan/intscan.ini if [ $? -ne 0 ] ; then echo $ERROR_LINE >> /usr/tmp/iscan_install_log rm -rf $TVCSPATH else print print "\tNote: Be sure to register this InterScan Agent" print "\t from the web configuration page." ISTVCS="Installed" INSTTVCS="NO" fi print PressAnyKey rm -rf /tmp/pkgtvcs fi } #======================================================== # InstallADMOnly handles the installation of ADM package. #======================================================== function InstallADMOnly { if [ "$INSTADMIN" = "YES" && "$ISADMIN" = "Installed" ] ; then print "\t\t${BOLD}InterScan ADMIN has been installed in your system${UNBOLD}" PressAnyKey INSTADMIN="NO" fi # print "\t\t${BOLD}Start Install IScan Admin...!${UNBOLD}\n" if [ "$INSTADMIN" = "YES" ] ; then if [ ! -s ./$ADMINPKG ] ; then print "\t\tCan not find Trend FileScan for Linux Admin ($ADMINPKG) in current directory." | fmt -70 PressAnyKey return fi ( cd /tmp ; mkdir pkgadmin ) /bin/zcat < ./$ADMINPKG | ( cd /tmp/pkgadmin ; tar xf - ) pkgadd -d /tmp/pkgadmin -R "$ADMINPATH" ISADMIN if [ $? -ne 0 ] ; then echo $ERROR_LINE >> /usr/tmp/iscan_install_log rm -rf $ADMINPATH else ISADMIN="Installed" fi PressAnyKey rm -rf /tmp/pkgadmin INSTADMIN="NO" fi } #========================================================== # InstallBASEOnly handles the installation of BASE package. # NOTE: This function is not called anywhere. Perhaps the # other routines that do a BASE installation can # simply call this routine. Makes for easier # maintenance. #========================================================== function InstallBASEOnly { if [ "$INSTBASE" = "YES" ] ; then if [ ! -s ./$BASEPKG ] ; then print "\t\tCan not find your Trend FileScan for Linux Base system software ( $BASEPKG ) in current directory." | fmt -70 PressAnyKey return fi # start install base pkg (cd /tmp ; mkdir pkgbase ) /bin/zcat < ./$BASEPKG | (cd /tmp/pkgbase ; tar xf - ) pkgadd -d /tmp/pkgbase -R "$BASEPATH" ISBASE if [ $? -ne 0 ] ; then echo $ERROR_LINE >> /usr/tmp/iscan_install_log rm -rf $BASEPATH else ISBASE=Installed fi PressAnyKey rm -rf /tmp/pkgbase INSTBASE="NO" # checking admin pkg if [ ! -s ./$ADMINPKG ] ; then print "\t\tCan not find Trend FileScan for Linux Admin ( iscanhtp.tz ) in current d irectory." | fmt -70 PressAnyKey return fi fi } #============= # CVP routine. #============= function StartInstallCVP { # if install CVP do the following command. # Check if ADMIN pkg installed if [ "$ISADMIN" != "Installed" && "$INSTADMIN" != "YES" ] ; then print "${BOLD}" print "\t\tYou have to install Trend FileScan for Linux Virus ADMIN system." print "${UNBOLD}" PressAnyKey return fi if [ $ISBASE != "Installed" ] ; then InstallBASEOnly InstallADMOnly InstallCVPOnly InstallTVCSOnly else ## Install ADM PKG # InstallADMOnly # start install cvp pkg and check the licence # check cvp pkg if [ "$INSTCVP" = "YES" ] ; then if [ "$ISCVPTRIAL" = "1" ] ; then Header print ${BOLD} print "\tYou are currently running CVP Trial Version.\n" print ${UNBOLD} print -n "\tDo you want to re-install InterScan VirusWall for CVP? > " ; read RESP ChkResp $RESP "NO" if [ "$RESP" = "YES" ] ; then print -n "Removing the TRIAL VERSION." # pkgrm -R `cat /etc/iscan/pkg/ISCVP` ISCVP StartRemove "CVP" CVPPKG="iscvp.tz" else # print -n ${UNBOLD} INSTCVP="NO" return fi ISCVPTRIAL=0 InstallADMOnly InstallCVPOnly InstallTVCSOnly return fi ## if CVP (but not trial version )already installed if [ "$ISCVP" = "Installed" ] ; then clear Header print ${BOLD} print -n "\t\tYou are currently running InterScan for CVP.\n" print -n "\t\tPlease remove it before installing this version.\n" print ${UNBOLD} print -n "\t\tDo you want to remove it now? > " ; read RESP ChkResp $RESP "NO" if [ "$RESP" = "YES" ] ; then StartRemove "CVP" InstallADMOnly InstallCVPOnly InstallTVCSOnly return else INSTCVP="NO" return fi fi ## If there is Old Base and Admin exist. if [ "$ISFTP" = "Installed" || "$ISSMTP" = "Installed" || "$ISHTTP" = "Installed" ] ; then print ${BOLD} print -n "\tIf you are running InterScan VirusWall version 2.53 or earlier, \n" print -n "\tyou must remove ALL packages before installing the CVP version.\n" print -n "\tDo you want to do this now?\n" print print -n "\t\tyes -- remove all packages \n" print -n "\t\tno -- remove smtp, http, ftp only\n" print -n "\t\tquit \n" print ${UNBOLD} print -n "\tDo you want to remove all the packages?> " ; read RESP ChkResp $RESP "NO" if [ "$RESP" = "YES" ] ; then ### If ISTVCS already installed than reinstalled after remove ## All the package if [ "$ISTVCS" = "Installed" ] ; then INSTTVCS="YES" fi RemoveAll clear # print -n "\tStarting CVP installation ...\n" print StartInstallCVP return fi if [ "$RESP" = "NO" ] ; then # keep the base and admin. if [ "$ISFTP" = "Installed" ] ; then StartRemove "FTP" fi if [ "$ISHTTP" = "Installed" ] ; then StartRemove "HTTP" fi if [ "$ISSMTP" = "Installed" ] ; then StartRemove "SMTP" fi InstallADMOnly InstallCVPOnly InstallTVCSOnly return fi if [ "$RESP" = "QUIT" ] ; then return fi else ### Ther is no Other InterScan viruswall installed InstallADMOnly InstallCVPOnly InstallTVCSOnly return fi fi InstallADMOnly InstallTVCSOnly fi } #============= # CVP routine. #============= function MainMenuCVP { typeset done=false INSTALLCVP="YES" while [ $done = false ] ; do done=true { Header print "\t\tMain Menu" print MainStatusCVP print "\t1.\tInstall InterScan CVP sub-system." print print "\t2.\tRemove InterScan CVP sub-system." print # print "\t3.\tRegister InterScan with a Trend VCS server." # print print "\t3.\tConfigure InterScan CVP via web browser (exit Setup)." print print "\t4.\tBack to the First Page." print print "\t5.\tExit." } >&2 print ; print print -n " \tSelect a number > ";read RESP case $RESP in 1 ) InstallCVP ;; 2 ) RemoveCVP ;; # 3 ) VCCRegister ; done=false ;; 3 ) ConfigIScanUsingBrowser ; done=false;; 4 ) Main ; done=false;; 5 ) Exit ;; * ) print "\t\tAn invalid choice was entered. Please try again." done=false ;; esac done } #============ # CVP routine #============ function InstallCVP { while ( true ); do Header print print "\t\tInstall InterScan VirusWall Base System\t${DASH}\t[ ${BOLD}${INSTBASE}${UNBOLD}\t]" print "\t\tInstallation Path\t${BOLD}${BASEPATH}${UNBOLD}" print print "\t\tInstall InterScan VirusWall CGI Admin\t${DASH}\t[ ${BOLD}${INSTADMIN}${UNBOLD}\t]" print "\t\tInstallation Path\t${BOLD}${ADMINPATH}${UNBOLD}" print print "\t\tInstall InterScan VirusWall CVP System\t${DASH}\t[ ${BOLD}${INSTCVP}${UNBOLD}\t]" print "\t\tInstallation Path\t${BOLD}${CVPPATH}${UNBOLD}" print print "\t\tInstall InterScan VirusWall for TVCS\t${DASH}\t[ ${BOLD}${INSTTVCS}${UNBOLD}\t]" print "\t\tInstallation Path\t${BOLD}${TVCSPATH}${UNBOLD}" print { print "\t1.\tModify option for InterScan VirusWall for BASE." print "\t2.\tModify option for InterScan VirusWall for ADMIN." print "\t3.\tModify option for InterScan VirusWall for CVP. " print "\t4.\tModify option for InterScan VirusWall for TVCS." print "\t5.\tStart installation." print "\t6.\tBack to Main Menu." } >&2 print print -n " Select a number > " ; read RESP case $RESP in 1 ) Modify BASE ;; 2 ) Modify ADMIN ;; 3 ) Modify CVP ;; 4 ) Modify TVCS ;; 5 ) StartInstall ;; 6 ) MainMenuCVP ;; * ) print "${BELL}\t\tAn invalid choice was entered. Please try again." esac done } #==================================================================== # RemoveAll will remove all the InterScan packages that are installed # on the system. #==================================================================== function RemoveAll { prn_msg=1 if [ "$ISTVCS" = "Installed" ] ; then StartRemove "TVCS" prn_msg=0 fi if [ "$ISFTP" = "Installed" ] ; then StartRemove "FTP" prn_msg=0 fi if [ "$ISHTTP" = "Installed" ] ; then StartRemove "HTTP" prn_msg=0 fi if [ "$ISSMTP" = "Installed" ] ; then StartRemove "SMTP" prn_msg=0 fi if [ "$ISCVP" = "Installed" ] ; then StartRemove "CVP" prn_msg=0 fi if [ "$ISADMIN" = "Installed" ] ; then StartRemove "ADMIN" prn_msg=0 fi if [ "$ISBASE" = "Installed" ] ; then StartRemove "BASE" prn_msg=0 fi if [ "$prn_msg" = 1 ] ; then print $BOLD print "\t\tInterScan VirusWall is not installed." print $UNBOLD PressAnyKey fi } #========================================================= # Main presents the user with the initial menu of options. #========================================================= function Main { typeset loop=true # clear the screen clear # check to see if the installation sources are in the # current directory ChkPkg # check to see which InterScan packages are already # installed in the system ScanInstalledPackages ScanTrialPackages if [ "$INSTALLTYPE" = "Tar" ] ; then INSTALLCVP="NO" MainMenu elif [ "$INSTALLTYPE" = "AddPkg" ] ; then while [ $loop = true ] ; do loop=false Header print print print "\t1.\tInterScan Viruswall for CVP." print "\t2.\tInterScan VirusWall for FTP, SMTP, HTTP." print "\t3.\tExit." print print -n "\t\tSelect an option > " read RESP case $RESP in 1 ) INSTALLCVP="YES" MainMenuCVP ;; 2 ) INSTALLCVP="NO" MainMenu ;; 3 ) Exit ;; * ) print "${BELL}\t\tInvalid choice. Please try again." PressAnyKey loop=true ;; esac done fi } #==================== BEGIN ROUTINES FOR TAR INSTALLATION ======================== function BaseInstallUsingTar { # is the source in the current directory? if [ ! -s ./$BASEPKG ] ; then print "InterScan VirusWall Base system ($BASEPKG) not found in current directory." return fi print "Start installation of Base system." # if the target path does not exists, create it if [ ! -d $BASEPATH ] ; then mkdir -p $BASEPATH fi # remove all files from support directory rm -rf /tmp/iscan_support mkdir /tmp/iscan_support # untar the package files /bin/zcat < ./$BASEPKG | ( cd /tmp/iscan_support ; tar xf - 2> /dev/null ) # set file ownership and modes chown -R root /tmp/iscan_support/* chgrp -R sys /tmp/iscan_support/* chmod -R 555 /tmp/iscan_support/* # copy files to final destination \cp /tmp/iscan_support/* $BASEPATH \rm -rf /tmp/iscan_support #======================# # Postinstall for BASE # #======================# if [ -s /etc/iscan ] ; then rm -rf /etc/iscan/* else mkdir /etc/iscan mkdir /etc/iscan/virus fi chmod 0755 /etc/iscan chown root /etc/iscan chgrp bin /etc/iscan # create links from target area to /etc/iscan for i in ${BASEFILES} ; do cp ${BASEPATH}/$i /etc/iscan/$i \rm -f ${BASEPATH}/$i done chmod 644 /etc/iscan/intscan.ini chmod 444 /etc/iscan/intscan.ini.orig /etc/iscan/lpt* /etc/iscan/mac* # add 1 new cron jobs crontab -l > /tmp/istmp_cron echo "0 * * * * /etc/iscan/prescan.cgi >/dev/null 2>&1" >> /tmp/istmp_cron crontab /tmp/istmp_cron 2>/dev/null rm /tmp/istmp_cron # record base installation directory in /etc/iscan/pkg/ISBASE mkdir /etc/iscan/pkg chmod 0755 /etc/iscan/pkg chown root /etc/iscan/pkg chgrp bin /etc/iscan/pkg echo $BASEPATH > /etc/iscan/pkg/ISBASE # user has selected to upgrade, then restore their .ini and .log files if [ "$UPGRADE" = "YES" ] ; then /etc/iscan/uplog /tmp/iscan_dir/iscan.log /etc/iscan/virus.log \cp /tmp/iscan_dir/intscan.ini /etc/iscan/intscan.ini /etc/iscan/upgrade /etc/iscan/intscan.ini mkdir /etc/iscan/obsolete_log_ini \cp /tmp/iscan_dir/* /etc/iscan/obsolete_log_ini rm -rf /tmp/iscan_dir fi ISBASE="Installed" INSTBASE="NO" print "Finishing installation of Base system." } function BaseRemoveUsingTar { if [ -f /etc/iscan/pkg/ISBASE ] ; then BASEPATH=`cat /etc/iscan/pkg/ISBASE` else print $BOLD print "Cannot remove BASE; /etc/iscan/pkg/ISBASE not found." print $UNBOLD PressAnyKey return fi print "Start removal of Base system." # remove cron jobs (by removing all lines with cleanscan and prescan in them) /usr/bin/crontab -l | grep -v cleanscan | grep -v prescan > /tmp/iscron crontab /tmp/iscron 2>/dev/null rm -rf /tmp/iscron ATID=`grep "# notify_id" /etc/iscan/intscan.ini | cut -d' ' -f4` for ind in $ATID ; do atrm $ind done rm -rf /etc/iscan # remove installed files for i in ${BASEFILES} ; do rm -f $BASEPATH/$i done # now remove the base directory if it is empty rm -rf $BASEPATH # remove /opt/trend if it is empty rm -rf /opt/trend if [ ! -r /etc/iscan ] ; then ISBASE="None" INSTBASE="YES" fi print "Finish removal of Base system." } function AdminInstallUsingTar { # is the source in the current directory? if [ ! -s ./$ADMINPKG ] ; then print "InterScan Admin system ($ADMINPKG) not found in current directory." return fi # print message print "Start installation of Admin system." # if the target path does not exists, create it if [ ! -d $ADMINPATH ] ; then mkdir -p $ADMINPATH fi # remove all files from support directory rm -rf /tmp/iscan_support mkdir /tmp/iscan_support # untar the package files /bin/zcat < ./$ADMINPKG | ( cd /tmp/iscan_support ; tar xf - 2> /dev/null ) # set file ownership and modes chown -R root /tmp/iscan_support/* chgrp -R bin /tmp/iscan_support/* chmod -R 555 /tmp/iscan_support/* # copy files to final destination \cp -r /tmp/iscan_support/* $ADMINPATH \rm -rf /tmp/iscan_support # replace xxxxxxxx with hostname.domainname in the httpd.conf if [ -s /bin/domainname ] ; then NAME=`/bin/hostname` sed -e 's/xxxxxxxx/'$NAME'/' ${ADMINPATH}/config/httpd.conf > /tmp/pp$$ \cp /tmp/pp$$ ${ADMINPATH}/config/httpd.conf fi # replace globally all / with \/ echo $ADMINPATH | sed -e 's/\//\\\//g' > /tmp/tmpvar$$ # TMPVAR has the same path as $ADMINPATH but with the /'s escaped TMPVAR=`cat /tmp/tmpvar$$` ; rm -f /tmp/tmpvar$$ # replace all PKG_INSTALL_ROOT with the install path in $ADMINPATH sed -e 's/PKG_INSTALL_ROOT/'${TMPVAR}'/g' ${ADMINPATH}/config/httpd.conf > /tmp/pp$$ \cp /tmp/pp$$ ${ADMINPATH}/config/httpd.conf sed -e 's/PKG_INSTALL_ROOT/'${TMPVAR}'/g' ${ADMINPATH}/bin/iscanhttpd > /tmp/pp$$ \cp /tmp/pp$$ /etc/rc.d/init.d/iscanhttpd chown root /etc/rc.d/init.d/iscanhttpd chgrp sys /etc/rc.d/init.d/iscanhttpd chmod 0755 /etc/rc.d/init.d/iscanhttpd ln -s /etc/rc.d/init.d/iscanhttpd /etc/rc.d/rc3.d/S999IScanHttpd ln -s /etc/rc.d/init.d/iscanhttpd /etc/rc.d/rc0.d/K999IScanHttpd ln -s /etc/rc.d/init.d/iscanhttpd /etc/rc.d/rc5.d/S999IScanHttpd # start the Web Configuration Server /etc/rc.d/init.d/iscanhttpd start > /dev/null ln -s ${ADMINPATH}/cgi-bin/gettxt /usr/bin/gettxt ln -s ${ADMINPATH}/config/.htpasswd /etc/iscan/.htpasswd # Add by Jessica link some cgi programs to /etc/iscan for i in ${ADMINFILES} ; do ln -s ${ADMINPATH}/cgi-bin/$i /etc/iscan/$i chmod 544 /etc/iscan/$i chown bin /etc/iscan/$i chgrp bin /etc/iscan/$i done # link the group file to /etc/iscan ln -s ${ADMINPATH}/config/group /etc/iscan/.group chmod 544 /etc/iscan/.group chown root /etc/iscan/.group chown root /etc/iscan/.group # change mode 4755 CGIFILES="proxy.set pscan.set scancfg.set update.set setpasswd.cgi\ vlog purge.cgi scanning scannow.cgi getptn_net.cgi" for i in ${CGIFILES} ; do chmod 4755 ${ADMINPATH}/cgi-bin/$i done echo ${ADMINPATH} > /etc/iscan/pkg/ISADMIN rm /tmp/pp$$ ISADMIN="Installed" INSTADMIN="NO" print "Finish installation of Admin system." } function AdminRemoveUsingTar { if [ -f /etc/iscan/pkg/ISADMIN ] ; then ADMINPATH=`cat /etc/iscan/pkg/ISADMIN` else print $BOLD print "Cannot remove ADMIN; /etc/iscan/pkg/ISADMIN not found." print $UNBOLD PressAnyKey return fi print "Start removal of Admin system." /etc/rc.d/init.d/iscanhttpd stop 2> /dev/null rm -f /etc/iscan/*.html \ /etc/iscan/start.cgi \ /etc/iscan/shutdown.cgi \ /etc/iscan/daemonhup.sh \ /etc/iscan/isswitch.cgi \ /etc/iscan/.htpasswd \ /usr/bin/gettxt \ /etc/rc.d/rc0.d/K999IScanHttpd \ /etc/rc.d/rc3.d/S999IScanHttpd \ /etc/rc.d/rc5.d/S999IScanHttpd \ /etc/rc.d/init.d/iscanhttpd \ /etc/iscan/pkg/ISADMIN # remove the adm directories for i in ${ADMINDIRS} ; do rm -rf $ADMINPATH/$i done # now remove the directory if it is empty FILES=`ls $ADMINPATH` for i in $FILES do if [ ! -n $i ] ; then rm -rf $ADMINPATH fi done rm -rf $ADMINFILES ISADMIN="None" INSTADMIN="YES" print "Finish removal of Admin system." } function FTPInstallUsingTar { if [ "$ISFTP" = "Installed" ] ; then if [ "$ISFTPTRIAL" = 1 -a "$LICENSE" = "OK" ] ; then print "You have installed TRIAL VERSION of ISFTP on the system." print -n "Do you want to upgrade to the full version of InterScan VirusWall for FTP? > " read RESP ChkResp $RESP "no" if [ "$RESP" = "YES" ] ; then StartRemove "FTP" FTPPKG="isftp.tz" else return fi elif [ "$LICENSE" = "OK" ] ; then print "Full version of InterScan VirusWall for FTP is already installed." print "To reinstall ISFTP, please remove the package first." return fi else if [ "$LICENSE" = "OK" ] ; then FTPPKG="isftp.tz" else print -n "Do you want to install the trial version for FTP? > " read RESP ChkResp $RESP "NO" if [ "$RESP" = "YES" ] ; then ISFTPTRIAL="YES" FTPPKG="isftp.evl" else return fi fi fi # is the source in the current directory? if [ ! -s ./$FTPPKG ] ; then print "InterScan FTP system ($FTPPKG) not found in current directory." return fi print "Start installation of FTP system." # if the target path does not exist, create it if [ ! -d $FTPPATH ] ; then mkdir -p $FTPPATH fi # remove all files from support directory rm -rf /tmp/iscan_support mkdir /tmp/iscan_support # untar the package files /bin/zcat < ./$FTPPKG | ( cd /tmp/iscan_support ; tar xf - 2> /dev/null ) # set file ownership and modes chown -R root /tmp/iscan_support/* chgrp -R bin /tmp/iscan_support/* chmod -R 555 /tmp/iscan_support/* # copy files to final destination \cp /tmp/iscan_support/* $FTPPATH if [ "$FTPPKG" = "isftp.evl" ] ; then FTP_ORIG=${FTPPATH}/isftpd.trial else FTP_ORIG=${FTPPATH}/isftpd fi rm -f /etc/iscan/isftpd # LINUX BUG # ln -s $FTP_ORIG /etc/iscan/isftpd cp $FTP_ORIG /etc/iscan/isftpd \rm -f $FTP_ORIG chmod 555 /etc/iscan/isftpd chown root /etc/iscan/isftpd chgrp sys /etc/iscan/isftpd ln -s ${FTPPATH}/iscanftp /etc/rc.d/init.d/iscanftp chmod 755 /etc/rc.d/init.d/iscanftp chown root /etc/rc.d/init.d/iscanftp chgrp sys /etc/rc.d/init.d/iscanftp rm -f /etc/rc.d/rc3.d/S991IScanFTP ln -s /etc/rc.d/init.d/iscanftp /etc/rc.d/rc3.d/S991IScanFTP rm -f /etc/rc.d/rc0.d/K991IScanFTP ln -s /etc/rc.d/init.d/iscanftp /etc/rc.d/rc0.d/K991IScanFTP INETD=/etc/inetd.conf # comment out the line in /etc/inetd.conf containing # "/usr/lbin/ftpd" status=`grep "^#" $INETD | grep "in.ftpd"` if [ $? -eq 0 ] ; then sed -e "/ftp/s/# *//" $INETD > /tmp/tmp$$ \mv /tmp/tmp$$ $INETD fi ed $INETD <<EOF >/dev/null 2>/dev/null /in.ftpd s/\(.*\)/# \1/ . w q EOF # restart inetd INETDPID=`ps aux | grep '[^[]'inetd | grep -v grep | awk '{print $2}'` if [ "$INETDPID" ] ; then kill -HUP $INETDPID sleep 3 fi echo ${FTPPATH} > /etc/iscan/pkg/ISFTP ISFTP="Installed" INSTFTP="NO" print "Finish installation of FTP system." } function FTPRemoveUsingTar { if [ -f /etc/iscan/pkg/ISFTP ] ; then FTPPATH=`cat /etc/iscan/pkg/ISFTP` else print $BOLD print "Cannot remove FTP; /etc/iscan/pkg/ISFTP not found." print $UNBOLD PressAnyKey return fi print "Start removal of FTP system." # stop daemon /etc/rc.d/init.d/iscanftp stop 2>/dev/null >/dev/null status=`grep "^#" /etc/inetd.conf | grep "in.ftpd"` if [ "$status" != "" ] ; then sed -e "/in.ftpd/s/^# //" /etc/inetd.conf > /tmp/tmp$$ \mv /tmp/tmp$$ /etc/inetd.conf fi rm -f /etc/rc.d/init.d/iscanftp \ /etc/iscan/isftpd \ /etc/rc.d/rc3.d/S991IScanFTP \ /etc/rc.d/rc0.d/K991IScanFTP \ /etc/iscan/pkg/ISFTP # kill the inetd process INETDPID=`ps x | grep inetd | grep -v grep | awk '{print $1}'` if [ "$INETDPID" != "" ] ; then kill -1 $INETDPID 2>/dev/null >/dev/null fi # remove the ftp file for i in ${FTPFILES} ; do rm -f $FTPPATH/$i done # now remove the directory if it is empty FILES=`ls $FTPPATH` if [ ! -n $FILES ] ; then rm -rf $FTPPATH fi ISFTP="None" INSTFTP="YES" print "Finish removal of FTP system." } function SMTPInstallUsingTar { # loop=true # while [ $loop = true ] ; do # loop=false # print # print "\t1.\tInterScan Viruswall SMTP." # print "\t2.\tInterScan VirusWall Plugins for Sendmail." # print # print -n "\t\tSelect type of SMTP Viruswall to install > " # read RESP # case $RESP in # 1 ) ISPORS="issmtp" ;; # 2 ) ISPORS="isplug" ;; # * ) print "${BELL}\t\tInvalid choice. Please try again." # loop=true ;; # esac # done ISPORS="issmtp" if [ "$ISSMTP" = "Installed" ] ; then if [ "$ISSMTPTRIAL" = 1 -a "$LICENSE" = "OK" ] ; then print "You have installed TRIAL VERSION of ISSMTP on the system." print -n "Do you want to upgrade to the full version of InterScan VirusWall for SMTP? > " read RESP ChkResp $RESP "no" if [ "$RESP" = "YES" ] ; then StartRemove "SMTP" SMTPPKG="$ISPORS.tz" else return fi elif [ "$LICENSE" = "OK" ] ; then print "Full version of InterScan VirusWall for SMTP is already installed." print "To reinstall ISSMTP, please remove the package first." return fi else if [ "$LICENSE" = "OK" ] ; then SMTPPKG="$ISPORS.tz" else print -n "Do you want to install the trial version for SMTP? > " read RESP ChkResp $RESP "NO" if [ "$RESP" = "YES" ] ; then ISSMTPTRIAL="YES" SMTPPKG="$ISPORS.evl" else return fi fi fi # is the source in the current directory? if [ ! -a ./$SMTPPKG ] ; then print "InterScan SMTP system ($SMTPPKG) not found in current directory." return fi print "Start installation of SMTP system." if [ "$ISPORS" = "isplug" ] ; then /etc/iscan/pluginst if [ "$?" != 0 ] ; then print "Installation of SMTP Plugins failed." print "Finish installation of SMTP system." return fi fi # if the target path does not exist, create it if [ ! -d $SMTPPATH ] ; then mkdir $SMTPPATH fi # remove all files from support directory rm -rf /tmp/iscan_support mkdir /tmp/iscan_support # untar the package files /bin/zcat < ./$SMTPPKG | ( cd /tmp/iscan_support ; tar xf - 2> /dev/null ) # set file ownership and modes chown -R root /tmp/iscan_support/* chgrp -R sys /tmp/iscan_support/* chmod -R 555 /tmp/iscan_support/* # copy files to final destination \cp /tmp/iscan_support/* $SMTPPATH if [ "$ISPORS" = "isplug" ] ; then if [ "$SMTPPKG" = "isplug.evl" ] ; then ln -s $SMTPPATH/isfilter.trial /etc/iscan/isfilter else ln -s $SMTPPATH/isfilter /etc/iscan/isfilter fi chmod 555 /etc/iscan/isfilter chown root /etc/iscan/isfilter chgrp sys /etc/iscan/isfilter chmod +s /etc/iscan/isfilter # anti spamming in v3.0 if [ ! -d /etc/iscan/Spamdb ] ; then mkdir -p /etc/iscan/Spamdb chmod 744 /etc/iscan/Spamdb chown root /etc/iscan/Spamdb chgrp root /etc/iscan/Spamdb fi # print SMTP plugins readme cat /etc/iscan/plugreadme else rm -f /etc/iscan/sendmail if [ "$SMTPPKG" = "issmtp.evl" ] ; then cp ${SMTPPATH}/issmtpd.trial /etc/iscan/sendmail \rm -f ${SMTPPATH}/issmtpd.trial else cp ${SMTPPATH}/issmtpd /etc/iscan/sendmail \rm -f ${SMTPPATH}/issmtpd fi chmod 551 /etc/iscan/sendmail chown root /etc/iscan/sendmail chgrp sys /etc/iscan/sendmail \cp /etc/rc.d/init.d/sendmail /etc/iscan/sendmail.org rm -f /etc/rc.d/init.d/sendmail ln -s ${SMTPPATH}/iscansmtp /etc/rc.d/init.d/sendmail chmod 555 /etc/rc.d/init.d/sendmail chown bin /etc/rc.d/init.d/sendmail chgrp bin /etc/rc.d/init.d/sendmail fi echo ${SMTPPATH} > /etc/iscan/pkg/ISSMTP ISSMTP="Installed" INSTSMTP="NO" print "Finish installation of SMTP system." } function SMTPRemoveUsingTar { if [ -f /etc/iscan/pkg/ISSMTP ] ; then SMTPPATH=`cat /etc/iscan/pkg/ISSMTP` else print $BOLD print "Cannot remove SMTP; /etc/iscan/pkg/ISSMTP not found." print $UNBOLD PressAnyKey return fi print "Start removal of SMTP system." if [ -a /etc/iscan/isfilter ] ; then # stop sendmail daemon /etc/rc.d/init.d/sendmail stop > /dev/null # restore original sendmail.cf configuration file if [ -s /etc/iscan/sendmail.cf.org ] ; then \cp /etc/iscan/sendmail.cf.org /etc/sendmail.cf fi # restart daemon /etc/rc.d/init.d/sendmail start > /dev/null # remove links and files rm -f /etc/iscan/sendmail \ /etc/iscan/sendmail.cf.org \ /etc/iscan/pkg/ISSMTP \ /etc/iscan/isfilter \ /etc/iscan/sendmail.cf.is \ ${SMTPPATH}/isfilter.trial \ ${SMTPPATH}/isfilter # anti spamming in v3.0 rm -rf /etc/iscan/Spamdb else /etc/rc.d/init.d/sendmail stop > /dev/null rm -f /etc/rc.d/init.d/sendmail # restart sendmail \cp /etc/iscan/sendmail.org /etc/rc.d/init.d/sendmail /etc/rc.d/init.d/sendmail start > /dev/null rm -f /etc/iscan/sendmail rm -f /etc/iscan/pkg/ISSMTP # remove files for i in $SMTPFILES ; do rm -f $SMTPPATH/$i done fi # now remove the directory if it is empty FILES=`ls $SMTPPATH` if [ ! -n $FILES ] ; then rm -rf $SMTPPATH fi \rm -f /etc/iscan/sendmail.org ISSMTP="None" INSTSMTP="YES" print "Finish removal of SMTP system." } function HTTPInstallUsingTar { if [ "$ISHTTP" = "Installed" ] ; then if [ "$ISHTTPTRIAL" = 1 -a "$LICENSE" = "OK" ] ; then print "You have installed TRIAL VERSION of ISHTTP on the system." print -n "Do you want to upgrade to the full version of InterScan VirusWall for HTTP? > " read RESP ChkResp $RESP "no" if [ "$RESP" = "YES" ] ; then StartRemove "HTTP" HTTPPKG="ishttp.tz" else return fi elif [ "$LICENSE" = "OK" ] ; then print "Full version of InterScan VirusWall for HTTP is already installed." print "To reinstall ISHTTP, please remove the package first." return fi else if [ "$LICENSE" = "OK" ] ; then HTTPPKG="ishttp.tz" else print -n "Do you want to install the trial version for HTTP? > " read RESP ChkResp $RESP "NO" if [ "$RESP" = "YES" ] ; then ISHTTPTRIAL="YES" HTTPPKG="ishttp.evl" else return fi fi fi # is the source in the current directory? if [ ! -s ./$HTTPPKG ] ; then print "InterScan HTTP system ($HTTPPKG) not found in current directory." return fi print "Start installation of HTTP system." # if the target path does not exist, create it if [ ! -d $HTTPPATH ] ; then mkdir $HTTPPATH fi # remove all files from support directory rm -rf /tmp/iscan_support mkdir /tmp/iscan_support # untar the package files /bin/zcat < ./$HTTPPKG | ( cd /tmp/iscan_support ; tar xf - 2> /dev/null ) # set file ownership and modes chown -R root /tmp/iscan_support/* chgrp -R bin /tmp/iscan_support/* chmod -R 555 /tmp/iscan_support/* # copy files to final destination \cp /tmp/iscan_support/* $HTTPPATH if [ "$HTTPPKG" = "ishttp.evl" ] ; then HTTP_ORIG=${HTTPPATH}/ishttpd.trial else HTTP_ORIG=${HTTPPATH}/ishttpd fi rm -f /etc/iscan/ishttpd # LINUX BUG # ln -s $HTTP_ORIG /etc/iscan/ishttpd cp $HTTP_ORIG /etc/iscan/ishttpd \rm -f $HTTP_ORIG chmod 555 /etc/iscan/ishttpd chown root /etc/iscan/ishttpd chgrp sys /etc/iscan/ishttpd rm -f /etc/rc.d/init.d/iscanhttpproxy ln -s ${HTTPPATH}/iscanhttpproxy /etc/rc.d/init.d/iscanhttpproxy chmod 744 /etc/rc.d/init.d/iscanhttpproxy chown root /etc/rc.d/init.d/iscanhttpproxy chgrp sys /etc/rc.d/init.d/iscanhttpproxy rm -f /etc/rc.d/rc3.d/S992IScanHTTP ln -s /etc/rc.d/init.d/iscanhttpproxy /etc/rc.d/rc3.d/S992IScanHTTP rm -f /etc/rc.d/rc0.d/K992IScanHTTP ln -s /etc/rc.d/init.d/iscanhttpproxy /etc/rc.d/rc0.d/K992IScanHTTP chmod 744 /etc/rc.d/rc3.d/S992IScanHTTP /etc/rc.d/rc0.d/K992IScanHTTP chown root /etc/rc.d/rc3.d/S992IScanHTTP /etc/rc.d/rc0.d/K992IScanHTTP chgrp sys /etc/rc.d/rc3.d/S992IScanHTTP /etc/rc.d/rc0.d/K992IScanHTTP echo $HTTPPATH > /etc/iscan/pkg/ISHTTP ISHTTP="Installed" INSTHTTP="NO" print "Finish installation of HTTP system." } function HTTPRemoveUsingTar { if [ -f /etc/iscan/pkg/ISHTTP ] ; then HTTPPATH=`cat /etc/iscan/pkg/ISHTTP` else print $BOLD print "Cannot remove HTTP; /etc/iscan/pkg/ISHTTP not found." print $UNBOLD PressAnyKey return fi print "Start removal of HTTP system." # stop daemon /etc/rc.d/init.d/iscanhttpproxy stop > /dev/null rm -f /etc/rc.d/init.d/iscanhttpproxy \ /etc/rc.d/rc3.d/S992IScanHTTP \ /etc/rc.d/rc0.d/K992IScanHTTP \ /etc/iscan/ishttpd \ /etc/iscan/pkg/ISHTTP # remove http files for i in ${HTTPFILES} ; do rm -f $HTTPPATH/$i done # now remove the directory if it is empty FILES=`ls $HTTPPATH` if [ ! -n $FILES ] ; then rm -rf $HTTPPATH fi ISHTTP="None" INSTHTTP="YES" print "Finish removal of HTTP system." } function TVCSInstallUsingTar { # is the source in the current directory? if [ ! -s ./$TVCSPKG ] ; then print "InterScan TVCS system ($TVCSPKG ) not found in current directory." return fi print "Start installation of TVCS system." # if the target path does not exists, create it if [ ! -d $TVCSPATH ] ; then mkdir $TVCSPATH fi # remove all files from support directory rm -rf /tmp/iscan_support mkdir /tmp/iscan_support # untar the package files /bin/zcat < ./$TVCSPKG | ( cd /tmp/iscan_support ; tar xf - 2> /dev/null ) # set file ownership and modes chown -R root /tmp/iscan_support/* chgrp -R bin /tmp/iscan_support/* chmod -R 555 /tmp/iscan_support/* # copy files to final destination \cp /tmp/iscan_support/* $TVCSPATH # link files to cgi-bin directory of admin package TVCS_CGI="Register SolarCommand tvcscfg tvcsinfo.cgi tvcsreg.cgi tvcsun_set.cgi tvcsunint.cgi TvcsRetrieve.exe" for i in ${TVCS_CGI} ; do ln -s ${TVCSPATH}/$i ${ADMINPATH}/cgi-bin done TVCSFILES="vcagt solar.ini tvcs_unint.sh" for i in ${TVCSFILES} ; do ln -s ${TVCSPATH}/$i /etc/iscan/$i chmod 544 /etc/iscan/$i chown root /etc/iscan/$i chgrp sys /etc/iscan/$i done ln -s ${TVCSPATH}/iscantvcsagt /etc/rc.d/init.d/iscantvcsagt chmod 755 /etc/rc.d/init.d/iscantvcsagt chown root /etc/rc.d/init.d/iscantvcsagt chgrp sys /etc/rc.d/init.d/iscantvcsagt rm -f /etc/rc.d/rc3.d/S993IScanTVCS ln -s /etc/rc.d/init.d/iscantvcsagt /etc/rc.d/rc3.d/S993IScanTVCS rm -f /etc/rc.d/rc0.d/K993IScanTVCS ln -s /etc/rc.d/init.d/iscantvcsagt /etc/rc.d/rc0.d/K993IScanTVCS ln -s $TVCSPATH/tvcs /etc/iscan/.tvcs chmod 755 /etc/iscan/.tvcs chown root /etc/iscan/.tvcs chgrp bin /etc/iscan/.tvcs # Append solar.ini to intscan.ini cat /etc/iscan/solar.ini >> /etc/iscan/intscan.ini echo $TVCSPATH > /etc/iscan/pkg/ISTVCS ISTVCS="Installed" INSTTVCS="NO" print "Finish installation of TVCS system." print print "\tNote: Be sure to register the TVCS Agent" print "\t from the Web configuration page." } function TVCSRemoveUsingTar { if [ -f /etc/iscan/pkg/ISTVCS ] ; then PATHTVCS=`cat /etc/iscan/pkg/ISTVCS` else print $BOLD print "Cannot remove TVCS; /etc/iscan/pkg/ISTVCS not found." print $UNBOLD PressAnyKey return fi print "Start removal of TVCS system." # remove tvcs links in cgi-bin directory of admin package TVCS_CGI="Register SolarCommand tvcscfg tvcsinfo.cgi tvcsreg.cgi tvcsun_set.cgi tvcsunint.cgi TvcsRetrieve.exe" for i in ${TVCS_CGI} ; do rm -f ${ADMINPATH}/cgi-bin/$i done CGIPATH=`cat /etc/iscan/pkg/ISADMIN` /etc/rc.d/init.d/iscantvcsagt stop rm -f /etc/iscan/ip \ /etc/iscan/vcagt \ /etc/iscan/solar.ini \ /etc/iscan/.tvcs \ /etc/iscan/pkg/ISTVCS \ /etc/iscan/tvcs_unint.sh \ /etc/rc.d/init.d/iscantvcsagt \ /etc/rc.d/rc0.d/K993IScanTVCS \ /etc/rc.d/rc3.d/S993IScanTVCS \ ${CGIPATH}/cgi-bin/Register \ ${CGIPATH}/cgi-bin/SolarCommand ed /etc/iscan/intscan.ini <<EOF >/dev/null 2>/dev/null /\[TVCS .,+19d . w q EOF # remove tvcs files TVCSFILES="ISCANTVCSAGT Register ip solar.ini vcagt SolarCommand iscantvcsagt tvcs_unint.sh .tvcs register.gif tvcs tvcscfg tvcsinfo.cgi tvcsreg.cgi tvcsun_set.cgi tvcsunint.cgi uninstall.gif" for i in ${TVCSFILES} ; do rm -f ${PATHTVCS}/$i done # now remove the directory if it is empty TVCSFILES=`ls $PATHTVCS` if [ ! -n $TVCSFILES ] ; then rm -rf $PATHTVCS fi ISTVCS="None" INSTTVCS="YES" print "Finish removal of TVCS system." } #==================== END ROUTINES FOR TAR INSTALLATION ======================== #=======================================================# # CheckLicense prompts the user for a software license. # #=======================================================# function CheckLicense { if [ ! -s /etc/iscan/license ] ; then print "License program not found." return fi loop=true while [ $loop = true ] ; do loop=false print -n "Please input your serial number for InterScan: " /etc/iscan/license > /dev/null if [ "$?" = "0" ] ; then LICENSE="OK" else print "The serial number entered is invalid. Do you want to re-enter the" print -n " serial number? (Yes/No) > " read RESP ChkResp $RESP NO if [ "$RESP" = "YES" ] ; then loop=true fi fi done if [ "$LICENSE" = "NOTOK" ] ; then print "The serial number is invalid. You will only be able to install the" print " trial versions of InterScan." fi } ######## Main Program ######## function ignorehup { # trap ignorehup INT Main } # check user ID id | grep root > /dev/null 2>&1 if [ $? -ne 0 ] then echo "You must be super-user (root) to execute this script." PressAnyKey exit 1 fi # trap ignorehup INT # create temporary support directory rm -rf /tmp/iscan_support # launch first menu echo "start Main" Main